//
//  TabarViewController.m
//  NavgationController
//
//  Created by sr Liu on 2020/7/17.
//  Copyright © 2020 sr Liu. All rights reserved.
//

#import "TabarViewController.h"
#import <ReactiveObjC/ReactiveObjC.h>
@interface TabarViewController ()

@end

@implementation TabarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor cyanColor];
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    
    __weak typeof(self) weakSelf = self;
    [RACObserve(self.tabBar, hidden) subscribeNext:^(id  _Nullable x) {
        __strong typeof(weakSelf) strongSelf = weakSelf;
        //泄漏在这里，应该是动画执行中调用了layout,具体持有vc的原因,应该还是动画的问题
        //push yes  pop yes  hidesBottomBarWhenPushed 这三个地方造成了vc不释放
        //如果修改其中一个或两个为NO就没事
//        [strongSelf.view layoutIfNeeded];
        //或者 放到下一个任务
        dispatch_async(dispatch_get_main_queue(), ^{
            [strongSelf.view layoutIfNeeded];
        });
    }];
}


@end
